<?php

/*
 * This file is part of the Geek-Zoo Projects.
 *
 * @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
 * @author quqiang <quqiang@geek-zoo.com>
 *
 */

require ROOT_PATH.'/Helper/admin_abstract.php';

    
class Action extends admin_abstract
{
    
    function index()
    {
        $data = _model('business_input')->getList("ORDER BY add_time DESC", new Pager(20));
        $this->view->assign($data);
        $this->view->display('admin/business_input.html');
    }
    
    function delete()
    {
        $id = _GET('id', 0);
        if ($id) {
            _model('business_input')->delete(array('id'=>$id));
            $this->redirect();
        }
    }
    
    function view()
    {
        $id = _GET('id', 0);
        if (!$id) {
            $this->redirect();
        }
        $option = _model('assets')->read(array('id'=>'14'));
        $option = explode('|', $option['description']);
        $data = _model('business_input')->read(array('id'=>$id));
        // $data = array_filter($data);
        unset($data['id']);
        unset($data['add_time']);
        $newdata = array();
        $ii = 1;
        foreach ($data as $key => $value) {
            $newdata[$ii] = $value;
            $ii++;
        }
        $this->view->assign('data', $newdata);
        $this->view->assign('option', $option);
        $this->view->display('admin/business_input_view.html');
    }
}


?>